<%--
  Created by IntelliJ IDEA.
  User: 30890
  Date: 2023/4/16
  Time: 21:18
  To change this template use File | Settings | File Templates.
--%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录界面</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            margin: 0;
            background-color: #f0f2f5;
        }

        #loginBox {
            width: 100%;
            max-width: 400px;
            padding: 30px;
            background-color: white;
            border-radius: 10px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }

        h1 {
            text-align: center;
            margin-bottom: 30px;
            color: #333;
            font-weight: bold;
        }

        form {
            display: flex;
            flex-direction: column;
        }

        label {
            font-size: 18px;
            margin-bottom: 5px;
        }

        input[type="text"],
        input[type="password"] {
            font-size: 16px;
            padding: 10px;
            margin-bottom: 20px;
            border: 1px solid #ddd;
            border-radius: 5px;
        }

        input[type="submit"] {
            padding: 10px 20px;
            font-size: 18px;
            color: white;
            background-color: #4CAF50;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            transition: background-color 0.3s ease;
        }

        input[type="submit"]:hover {
            background-color: #45a049;
        }

        #tip {
            color: red;
            font-size: 14px;
            text-align: center;
            margin-top: 10px;
        }

    </style>
</head>
<body>
<div id="loginBox">
    <h1>教 务 管 理 系 统</h1>
    <form action="userLogin" method="post" onsubmit="return checkLogin()">
        <label for="userAccount">账户：</label>
        <input type="text" id="userAccount" name="userAccount" required>
        <label for="userPassword">密码：</label>
        <input type="password" id="userPassword" name="userPassword" required>
        <input type="submit" value="登录">
        <span id="tip">${tip}</span>
    </form>
</div>
</body>
</html>

<script>
    function checkLogin() {
        let userAccount = document.getElementById("userAccount").value;
        let userPassword = document.getElementById("userPassword").value;
        if (!userAccount) {
            document.getElementById("tip").innerText = "账户不能为空";
            return false;
        }
        if (!userPassword) {
            document.getElementById("tip").innerText = "密码不能为空";
            return false;
        }
        document.getElementById("tip").innerText = ""; // 清除提示信息
        return true;
    }
</script>
